home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / WRAPOS_F.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  58 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   WRAPOS_F.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. $INCLUDE "DAS-NB01.INC"
  19. $INCLUDE "DAS-NB02.INC"
  20. $INCLUDE "DAS-NBT1.INC"
  21. COLOR 7, 0
  22. CLS
  23. ? "┌───────────────────────────────────────────────────────────────────────
  24. ? "│ fWrapPosF%( Start%, T$$, LineLen%, CrLf??, Twid? )
  25. ? "├─────────────────────────────────────────────────────────────────────────
  26. ? "│ TINPUT_B is the function that handles the BLOCK inputs and uses this
  27. ? "│ function to find the wrap position within the string being edited.
  28. ? "│ Start%   is the mid-pos to start printing at
  29. ? "│ T$$      is the string being printed/wrapped
  30. ? "│ LineLen% is the number of columns to be covered
  31. ? "│ CrLf??   is a 1 or 2 byte end-of-line character
  32. ? "│ Twid?    is the number of characters to expand tabs (chr$(9)) to
  33. ? "│ TprintLine is used to do the final printing and you may wish to have
  34. ? "│            a quick look at how it works. SEE: TprintLine
  35. ? "└─────────────────────────────────────────────────────────────────────────────
  36.  
  37. MAP T$$ * 272
  38. T$$ = "Once upon a time, in a land far, far away lived a little princess. "  +_
  39.       "She was so beautiful that when people looked at her their eyes hurt. "+_
  40.       "So her father, the king, locked her away in a small room at the top " +_
  41.       "of a very tall tower."
  42.  
  43. Row?     = 15
  44. LineLen% = 60
  45. CrLf??   = 0
  46. TabWid?  = 0
  47. P2%      = 0
  48. TBoxFill Row?-1, 1, 10, 80, 177, 15
  49.  
  50. DO
  51.   P1% = ( P2% + 1 )                                         ' starting mid
  52.   P2% = fWrapPosF%( P1%, T$$, LineLen%, CrLf??, TabWid? )   ' ending mid
  53.   L$ = fMID$( T$$, P1%, P2% )                               ' cut out mid$
  54.   TprintLine Row?, 1, LineLen%, L$, 1, CrLf??, TabWid?, 14  ' print it!
  55.   INCR Row?, 1                                              ' next row
  56. LOOP UNTIL ( P2% = LEN( T$$ ) )                             '
  57.  
  58.